//
//  OADViewLifecycleViewModel.m
//  OASDK_Works
//
//  Created by ChenJie on 5/21/20.
//  Copyright © 2020 Mist. All rights reserved.
//

#import "OADViewLifecycleViewModel.h"
#import "OASDK.h"

@interface OADViewLifecycleViewModel ()

@end

@implementation OADViewLifecycleViewModel

#pragma mark - Lifecycle methods

- (instancetype)init {
    self = [super init];
    if (self) {
    }
    return self;
}

#pragma mark - Public methods



#pragma mark - Private methods



#pragma mark - Delegate methods



#pragma mark - Setter



#pragma mark - Getter

- (OADTitleHeaderViewModel *)headerViewModel {
    if (!_headerViewModel) {
        OADTitleHeaderViewModel *viewModel = [[OADTitleHeaderViewModel alloc] init];
        
        NSArray *fields = @[
            @{
                @"title": @"-=-",
                @"width": @(50),
            },
            @{
                @"title": @"Two Two Two Two Two Two Two",
                @"flex": @(1),
            },
            @{
                @"title": @"Three Three Three",
                @"width": @(80),
            },
            @{
                @"title": @"Four",
                @"width": @(80),
            },
        ];
        
        for (NSDictionary *fieldInfo in fields) {
            NSString *title = fieldInfo[@"title"];
            CGFloat width = [fieldInfo[@"width"] floatValue];
            CGFloat flex = [fieldInfo[@"flex"] floatValue];
            
            OADTitleHeaderFieldViewModel *fieldViewModel
            = [OADTitleHeaderFieldViewModel fieldWithTitle:title width:width flex:flex];
            
            [viewModel addField:fieldViewModel];
        }
        
        _headerViewModel = viewModel;
    }
    return _headerViewModel;
}

#pragma mark - Memory management methods

- (void)dealloc {
    OALogFunction
}

@end
